package com.hfzy.ihk.common.web.converter;


import com.hfzy.ihk.common.util.string.StringUtil;
import com.hfzy.ihk.common.util.Utils;
import org.springframework.core.convert.converter.Converter;

import java.util.Date;

/**
 * Created by Administrator on 2018/1/22.
 * string 2 date
 * 接收页面的
 * @author wws
 */

public class StringToDateConverter implements Converter<String, Date> {

    @Override
    public Date convert(String source) {

        if(StringUtil.isEmpty(source)) {
            return null;
        }

        return Utils.string2Date(source.trim(),Utils.DATE_FORMAT_DATETIME);
    }
}
